#ifndef COMMON_ITERATORPTR_H
#define COMMON_ITERATORPTR_H

#include "Common/Collections/IIterator.h"
#include "Common/Collections/IIterable.h"

namespace cmn {

	template<typename T>
	class IteratorPtr : public IIterator<T> {
	public:
		IteratorPtr( const IIterable<T>* iterable ) :
			m_iterator( iterable->GetIterator() )
		{}

		IteratorPtr( const IIterable<T>& iterable ) :
			m_iterator( iterable.GetIterator() )
		{}

		~IteratorPtr() { delete m_iterator;}

		virtual void Start() { m_iterator->Start(); }
		virtual void Next() { m_iterator->Next(); }
		virtual T Current() { return m_iterator->Current(); };
		virtual bool IsEnd() { return m_iterator->IsEnd(); }

	private:
		IIterator<T>* m_iterator;
	};
}
#endif
